using System.Web.Mvc;
using DesigningViews.Models;
using MvcContrib;

namespace DesigningViews.Controllers
{
	public class AuthController : Controller
	{
		public RedirectToRouteResult Login()
		{
			Session["CurrentUser"] = new User {Username = "kman", Name = "Cosmo Kramer"};

			return this.RedirectToAction<HomeController>(c => c.Index());
		}
	
		public RedirectToRouteResult Logout()
		{
			Session["CurrentUser"] = null;

			return this.RedirectToAction<HomeController>(c => c.Index());
		}

		public ViewResult Show()
		{
			var currentUser = Session["CurrentUser"] as User;

			return View(currentUser);
		}
	}
}